package leetcode_401_500;

import java.util.Arrays;

public class LeeCode_462 {
    public static void main(String[] args) {

    }
    private static int minMoves2(int[] nums) {
        Arrays.sort(nums);
        int l = 0, r = nums.length - 1, ans = 0;
        while (l < r){
            ans += nums[r--] - nums[l++];
        }
        return ans;
    }
}
